Skip to content

Feat/ci pipeline#107

Merged
TatjanaTrajkovic merged 6 commits into
mainfrom
feat/ci-pipeline
Apr 4, 2026
Merged

Feat/ci pipeline#107
TatjanaTrajkovic merged 6 commits into
mainfrom
feat/ci-pipeline

Conversation

@TatjanaTrajkovic

@TatjanaTrajkovic TatjanaTrajkovic commented Apr 2, 2026

Copy link
Copy Markdown
Contributor

feat: add CI pipeline with build and test workflow

Summary by CodeRabbit

  • Chores
    • Added automated CI workflow that runs builds and tests on pushes and pull requests to main, including Java/Maven setup, dependency caching, and upload of build artifacts after successful main pushes.
  • Tests
    • Added a new basic test intended to validate the pipeline; the test currently fails and will cause CI test runs to fail until fixed.

@coderabbitai

coderabbitai Bot commented Apr 2, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@TatjanaTrajkovic has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 23 minutes and 33 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 23 minutes and 33 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0d141943-bec8-4d84-85e2-43d6c34e1d2c

📥 Commits

Reviewing files that changed from the base of the PR and between 4050f29 and f7278eb.

📒 Files selected for processing (1)
  • src/test/java/org/example/vet1177/ci_dummy_test/CiDummyTest.java
📝 Walkthrough

Walkthrough

Adds a new GitHub Actions CI workflow .github/workflows/ci.yml that runs on push and pull_request to main, sets up Temurin JDK 25, caches Maven (~/.m2), runs mvn clean verify with repo secrets, and uploads target/*.jar on successful pushes. Also adds a JUnit test class whose single test currently asserts false (will fail).

Changes

Cohort / File(s) Summary
CI Pipeline Configuration
.github/workflows/ci.yml
Adds a new "CI Pipeline" workflow triggered on push and pull_request to main. Defines build-and-test job on ubuntu-latest that checks out code, installs Temurin JDK 25, caches Maven (~/.m2) with a key based on pom.xml hashes, injects DB/MinIO secrets into the Maven run, executes mvn clean verify, and uploads target/*.jar artifacts on successful pushes to main.
Test (failing)
src/test/java/org/example/vet1177/ci_dummy_test/CiDummyTest.java
Adds JUnit 5 test class CiDummyTest with one test method shouldPass() that calls assertTrue(false), which will cause the test to fail during CI.

Sequence Diagram(s)

sequenceDiagram
participant GitHub as GitHub (events)
participant Actions as GitHub Actions Runner
participant Checkout as actions/checkout@v5
participant SetupJava as actions/setup-java@v5
participant Cache as actions/cache@v5
participant Maven as Maven (mvn)
participant Secrets as Repo Secrets
participant Artifacts as actions/upload-artifact@v7

GitHub->>Actions: push / pull_request to main
Actions->>Checkout: checkout repository
Actions->>SetupJava: install Temurin JDK 25
Actions->>Cache: restore ~/.m2 (key: OS + hash(pom.xml*))
Actions->>Secrets: expose DB_* and MINIO_* env vars
Actions->>Maven: run mvn clean verify (env from Secrets)
Maven->>Cache: update ~/.m2 (save)
Maven-->>Actions: test/build results
Actions->>Artifacts: upload target/*.jar (on successful push to main)
Actions-->>GitHub: report status (success/failure)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I hopped into CI with a curious nose,
JDK boots on, and Maven rows and rows,
A test that bravely says "not today",
Artifacts wait to trot away—
I'll nibble the fix and then we glow ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Feat/ci pipeline' is directly related to the main change: adding a CI pipeline workflow. However, it uses a vague format and lacks clarity about the specific contribution.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/ci-pipeline

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (5)
.github/workflows/ci.yml (5)

9-11: Consider adding explicit permissions for enhanced security.

Modern GitHub Actions workflows should explicitly declare permissions following the principle of least privilege. This prevents potential security issues from token misuse.

🔒 Proposed addition of permissions configuration
 jobs:
   build-and-test:
     runs-on: ubuntu-latest
+    permissions:
+      contents: read
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/ci.yml around lines 9 - 11, The workflow currently lacks
an explicit permissions block for the "build-and-test" job; add a permissions
mapping under that job (or top-level) to follow least-privilege principles by
explicitly granting only the scopes required (e.g., contents: read, checks:
write) and deny others (set others to none), and ensure the "build-and-test" job
references that permissions block so the runner uses the restricted GITHUB_TOKEN
privileges.

9-11: Consider adding a job timeout to prevent resource waste.

Jobs without explicit timeouts can run indefinitely if they hang, consuming CI minutes. Adding a timeout-minutes is a best practice for CI workflows.

⏱️ Proposed addition of timeout configuration
 jobs:
   build-and-test:
     runs-on: ubuntu-latest
+    timeout-minutes: 30
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/ci.yml around lines 9 - 11, Add an explicit job timeout to
prevent indefinite runs by adding a timeout-minutes setting to the
build-and-test job; update the jobs -> build-and-test block (the job named
"build-and-test" that currently has "runs-on: ubuntu-latest") to include a
timeout-minutes: <value> (e.g., 30) so the CI workflow aborts hung jobs and
frees resources.

25-32: Consider using the built-in cache parameter in setup-java.

The actions/setup-java@v5 action has a built-in cache parameter that can handle Maven dependency caching automatically. This simplifies the workflow by eliminating the need for a separate cache action.

♻️ Alternative approach using built-in caching

Remove the separate cache step and add the cache parameter to the setup-java step:

       - name: Set up JDK
         uses: actions/setup-java@v5
         with:
           distribution: 'temurin'
           java-version: '25'
+          cache: 'maven'

-      # 3. Cache (snabbar upp builds)
-      - name: Cache Maven dependencies
-        uses: actions/cache@v5
-        with:
-          path: ~/.m2
-          key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
-          restore-keys: |
-            ${{ runner.os }}-maven
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/ci.yml around lines 25 - 32, The separate "Cache Maven
dependencies" step using actions/cache@v5 should be removed and replaced by
using the built-in cache parameter on the existing actions/setup-java@v5 step;
update the setup-java invocation to include cache: 'maven' (and optionally
cache-dependency-paths if custom) so Maven dependencies are cached automatically
instead of keeping the standalone Cache Maven dependencies step.

14-14: Consider using English for step comments.

The workflow uses Swedish comments (e.g., "Hämta koden", "Installera Java"). While this is not incorrect, using English is the standard practice for CI/CD configurations in international projects, improving accessibility for contributors from different regions.

🌍 Proposed translation to English
-      # 1. Hämta koden
+      # 1. Checkout code
       - name: Checkout code
         uses: actions/checkout@v5

-      # 2. Installera Java
+      # 2. Set up Java
       - name: Set up JDK
         uses: actions/setup-java@v5
         with:
           distribution: 'temurin'
           java-version: '25'

-      # 3. Cache (snabbar upp builds)
+      # 3. Cache Maven dependencies (speeds up builds)
       - name: Cache Maven dependencies
         uses: actions/cache@v5
         with:
           path: ~/.m2
           key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
           restore-keys: |
             ${{ runner.os }}-maven

-      # 4. Build + Test
+      # 4. Build and run tests
       - name: Build and run tests
         run: mvn clean verify

Also applies to: 18-18, 25-25, 34-34

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/ci.yml at line 14, Replace the Swedish step comments in
the CI workflow with English equivalents to improve accessibility; specifically
update strings like "Hämta koden" to "Checkout code", "Installera Java" to
"Install Java" and other Swedish comments found in the file so all step
descriptions are in English (search for those exact Swedish phrases to locate
the comments and update their text).

22-23: Consider using a Long-Term Support (LTS) Java version.

JDK 25 is not an LTS version and receives only 6 months of support. For production CI pipelines, using an LTS version like JDK 21 provides better long-term stability and extended support.

🔄 Proposed change to use JDK 21 LTS
         with:
           distribution: 'temurin'
-          java-version: '25'
+          java-version: '21'

Note: You would also need to update the java.version property in pom.xml to match.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/ci.yml around lines 22 - 23, Update the CI to use a Java
LTS release by changing the java-version value from '25' to '21' in the workflow
where the distribution is 'temurin' (keys: distribution and java-version); also
update the corresponding java.version property in pom.xml so the build and CI
use the same JDK version.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In @.github/workflows/ci.yml:
- Around line 9-11: The workflow currently lacks an explicit permissions block
for the "build-and-test" job; add a permissions mapping under that job (or
top-level) to follow least-privilege principles by explicitly granting only the
scopes required (e.g., contents: read, checks: write) and deny others (set
others to none), and ensure the "build-and-test" job references that permissions
block so the runner uses the restricted GITHUB_TOKEN privileges.
- Around line 9-11: Add an explicit job timeout to prevent indefinite runs by
adding a timeout-minutes setting to the build-and-test job; update the jobs ->
build-and-test block (the job named "build-and-test" that currently has
"runs-on: ubuntu-latest") to include a timeout-minutes: <value> (e.g., 30) so
the CI workflow aborts hung jobs and frees resources.
- Around line 25-32: The separate "Cache Maven dependencies" step using
actions/cache@v5 should be removed and replaced by using the built-in cache
parameter on the existing actions/setup-java@v5 step; update the setup-java
invocation to include cache: 'maven' (and optionally cache-dependency-paths if
custom) so Maven dependencies are cached automatically instead of keeping the
standalone Cache Maven dependencies step.
- Line 14: Replace the Swedish step comments in the CI workflow with English
equivalents to improve accessibility; specifically update strings like "Hämta
koden" to "Checkout code", "Installera Java" to "Install Java" and other Swedish
comments found in the file so all step descriptions are in English (search for
those exact Swedish phrases to locate the comments and update their text).
- Around line 22-23: Update the CI to use a Java LTS release by changing the
java-version value from '25' to '21' in the workflow where the distribution is
'temurin' (keys: distribution and java-version); also update the corresponding
java.version property in pom.xml so the build and CI use the same JDK version.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 971a4476-b03d-4a3c-934a-ae6003479fb6

📥 Commits

Reviewing files that changed from the base of the PR and between 6c3ddae and 7aa86d5.

📒 Files selected for processing (1)
  • .github/workflows/ci.yml

@TatjanaTrajkovic TatjanaTrajkovic linked an issue Apr 3, 2026 that may be closed by this pull request
@TatjanaTrajkovic
TatjanaTrajkovic merged commit 2e1148b into main Apr 4, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Setup Initial CI/CD Pipeline via GitHub Actions

1 participant